home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / ImageCodec.p < prev    next >
Encoding:
Text File  |  1997-08-12  |  14.6 KB  |  369 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ImageCodec.p
  3.  
  4.      Contains:    QuickTime Interfaces.
  5.  
  6.      Version:    Technology:    QuickTime 2.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1990-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT ImageCodec;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __IMAGECODEC__}
  28. {$SETC __IMAGECODEC__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ImageCodecIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __QUICKDRAW__}
  38. {$I Quickdraw.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __IMAGECOMPRESSION__}
  41. {$I ImageCompression.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __COMPONENTS__}
  44. {$I Components.p}
  45. {$ENDC}
  46.  
  47.  
  48. {$PUSH}
  49. {$ALIGN MAC68K}
  50. {$LibExport+}
  51.  
  52. {    codec capabilities flags    }
  53.  
  54. CONST
  55.     codecCanScale                = $00000001;
  56.     codecCanMask                = $00000002;
  57.     codecCanMatte                = $00000004;
  58.     codecCanTransform            = $00000008;
  59.     codecCanTransferMode        = $00000010;
  60.     codecCanCopyPrev            = $00000020;
  61.     codecCanSpool                = $00000040;
  62.     codecCanClipVertical        = $00000080;
  63.     codecCanClipRectangular        = $00000100;
  64.     codecCanRemapColor            = $00000200;
  65.     codecCanFastDither            = $00000400;
  66.     codecCanSrcExtract            = $00000800;
  67.     codecCanCopyPrevComp        = $00001000;
  68.     codecCanAsync                = $00002000;
  69.     codecCanMakeMask            = $00004000;
  70.     codecCanShift                = $00008000;
  71.     codecCanAsyncWhen            = $00010000;
  72.     codecCanShieldCursor        = $00020000;
  73.     codecCanManagePrevBuffer    = $00040000;
  74.     codecHasVolatileBuffer        = $00080000;
  75.     codecWantsRegionMask        = $00100000;
  76.     codecImageBufferIsOnScreen    = $00200000;
  77.     codecWantsDestinationPixels    = $00400000;
  78.  
  79.  
  80.  
  81. TYPE
  82.     CodecCapabilitiesPtr = ^CodecCapabilities;
  83.     CodecCapabilities = RECORD
  84.         flags:                    LONGINT;
  85.         wantedPixelSize:        INTEGER;
  86.         extendWidth:            INTEGER;
  87.         extendHeight:            INTEGER;
  88.         bandMin:                INTEGER;
  89.         bandInc:                INTEGER;
  90.         pad:                    INTEGER;
  91.         time:                    LONGINT;
  92.     END;
  93.  
  94. {    codec condition flags    }
  95.  
  96. CONST
  97.     codecConditionFirstBand        = $00000001;
  98.     codecConditionLastBand        = $00000002;
  99.     codecConditionFirstFrame    = $00000004;
  100.     codecConditionNewDepth        = $00000008;
  101.     codecConditionNewTransform    = $00000010;
  102.     codecConditionNewSrcRect    = $00000020;
  103.     codecConditionNewMask        = $00000040;
  104.     codecConditionNewMatte        = $00000080;
  105.     codecConditionNewTransferMode = $00000100;
  106.     codecConditionNewClut        = $00000200;
  107.     codecConditionNewAccuracy    = $00000400;
  108.     codecConditionNewDestination = $00000800;
  109.     codecConditionFirstScreen    = $00001000;
  110.     codecConditionDoCursor        = $00002000;
  111.     codecConditionCatchUpDiff    = $00004000;
  112.     codecConditionMaskMayBeChanged = $00008000;
  113.     codecConditionToBuffer        = $00010000;
  114.     codecConditionCodecChangedMask = $80000000;
  115.  
  116.  
  117.     codecInfoResourceType        = 'cdci';                        {  codec info resource type  }
  118.     codecInterfaceVersion        = 2;                            {  high word returned in component GetVersion  }
  119.  
  120.  
  121. TYPE
  122.     CDSequenceDataSourcePtr = ^CDSequenceDataSource;
  123.     CDSequenceDataSource = RECORD
  124.         recordSize:                LONGINT;
  125.         next:                    Ptr;
  126.         seqID:                    ImageSequence;
  127.         sourceID:                ImageSequenceDataSource;
  128.         sourceType:                OSType;
  129.         sourceInputNumber:        LONGINT;
  130.         dataPtr:                Ptr;
  131.         dataDescription:        Handle;
  132.         changeSeed:                LONGINT;
  133.         transferProc:            ICMConvertDataFormatUPP;
  134.         transferRefcon:            Ptr;
  135.                                                                         {  The following fields only exist for QuickTime 2.5 and greater  }
  136.         dataSize:                LONGINT;
  137.     END;
  138.  
  139.     CodecCompressParamsPtr = ^CodecCompressParams;
  140.     CodecCompressParams = RECORD
  141.         sequenceID:                ImageSequence;                            {  precompress,bandcompress  }
  142.         imageDescription:        ImageDescriptionHandle;                    {  precompress,bandcompress  }
  143.         data:                    Ptr;
  144.         bufferSize:                LONGINT;
  145.         frameNumber:            LONGINT;
  146.         startLine:                LONGINT;
  147.         stopLine:                LONGINT;
  148.         conditionFlags:            LONGINT;
  149.         callerFlags:            CodecFlags;
  150.         capabilities:            CodecCapabilitiesPtr;                    {  precompress,bandcompress  }
  151.         progressProcRecord:        ICMProgressProcRecord;
  152.         completionProcRecord:    ICMCompletionProcRecord;
  153.         flushProcRecord:        ICMFlushProcRecord;
  154.         srcPixMap:                PixMap;                                    {  precompress,bandcompress  }
  155.         prevPixMap:                PixMap;
  156.         spatialQuality:            CodecQ;
  157.         temporalQuality:        CodecQ;
  158.         similarity:                Fixed;
  159.         dataRateParams:            DataRateParamsPtr;
  160.         reserved:                LONGINT;
  161.                                                                         {  The following fields only exist for QuickTime 2.1 and greater  }
  162.         majorSourceChangeSeed:    UInt16;
  163.         minorSourceChangeSeed:    UInt16;
  164.         sourceData:                CDSequenceDataSourcePtr;
  165.                                                                         {  The following fields only exit for QuickTime 2.5 and greater  }
  166.         preferredPacketSizeInBytes: LONGINT;
  167.     END;
  168.  
  169.     CodecDecompressParamsPtr = ^CodecDecompressParams;
  170.     CodecDecompressParams = RECORD
  171.         sequenceID:                ImageSequence;                            {  predecompress,banddecompress  }
  172.         imageDescription:        ImageDescriptionHandle;                    {  predecompress,banddecompress  }
  173.         data:                    Ptr;
  174.         bufferSize:                LONGINT;
  175.         frameNumber:            LONGINT;
  176.         startLine:                LONGINT;
  177.         stopLine:                LONGINT;
  178.         conditionFlags:            LONGINT;
  179.         callerFlags:            CodecFlags;
  180.         capabilities:            CodecCapabilitiesPtr;                    {  predecompress,banddecompress  }
  181.         progressProcRecord:        ICMProgressProcRecord;
  182.         completionProcRecord:    ICMCompletionProcRecord;
  183.         dataProcRecord:            ICMDataProcRecord;
  184.         port:                    CGrafPtr;                                {  predecompress,banddecompress  }
  185.         dstPixMap:                PixMap;                                    {  predecompress,banddecompress  }
  186.         maskBits:                BitMapPtr;
  187.         mattePixMap:            PixMapPtr;
  188.         srcRect:                Rect;                                    {  predecompress,banddecompress  }
  189.         matrix:                    MatrixRecordPtr;                        {  predecompress,banddecompress  }
  190.         accuracy:                CodecQ;                                    {  predecompress,banddecompress  }
  191.         transferMode:            INTEGER;                                {  predecompress,banddecompress  }
  192.         frameTime:                ICMFrameTimePtr;                        {  banddecompress  }
  193.         reserved:                ARRAY [0..0] OF LONGINT;
  194.                                                                         {  The following fields only exist for QuickTime 2.0 and greater  }
  195.         matrixFlags:            SInt8;                                    {  high bit set if 2x resize  }
  196.         matrixType:                SInt8;
  197.         dstRect:                Rect;                                    {  only valid for simple transforms  }
  198.                                                                         {  The following fields only exist for QuickTime 2.1 and greater  }
  199.         majorSourceChangeSeed:    UInt16;
  200.         minorSourceChangeSeed:    UInt16;
  201.         sourceData:                CDSequenceDataSourcePtr;
  202.         maskRegion:                RgnHandle;
  203.                                                                         {  The following fields only exist for QuickTime 2.5 and greater  }
  204.         wantedDestinationPixelTypes: ^OSTypePtr;                        {  Handle to 0-terminated list of OSTypes  }
  205.         screenFloodMethod:        LONGINT;
  206.         screenFloodValue:        LONGINT;
  207.         preferredOffscreenPixelSize: INTEGER;
  208.     END;
  209.  
  210.  
  211. CONST
  212.     matrixFlagScale2x            = $00000080;
  213.     matrixFlagScale1x            = $00000040;
  214.     matrixFlagScaleHalf            = $00000020;
  215.  
  216.     kScreenFloodMethodNone        = 0;
  217.     kScreenFloodMethodKeyColor    = 1;
  218.     kScreenFloodMethodAlpha        = 2;
  219.  
  220. {    codec selectors 0-127 are reserved by Apple }
  221. {    codec selectors 128-191 are subtype specific }
  222. {    codec selectors 192-255 are vendor specific }
  223. {    codec selectors 256-32767 are available for general use }
  224. {    negative selectors are reserved by the Component Manager }
  225. FUNCTION ImageCodecGetCodecInfo(ci: ComponentInstance; VAR info: CodecInfo): ComponentResult;
  226.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  227.     INLINE $2F3C, $0004, $0000, $7000, $A82A;
  228.     {$ENDC}
  229. FUNCTION ImageCodecGetCompressionTime(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; VAR spatialQuality: CodecQ; VAR temporalQuality: CodecQ; VAR time: LONGINT): ComponentResult;
  230.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  231.     INLINE $2F3C, $0016, $0001, $7000, $A82A;
  232.     {$ENDC}
  233. FUNCTION ImageCodecGetMaxCompressionSize(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; quality: CodecQ; VAR size: LONGINT): ComponentResult;
  234.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  235.     INLINE $2F3C, $0012, $0002, $7000, $A82A;
  236.     {$ENDC}
  237. FUNCTION ImageCodecPreCompress(ci: ComponentInstance; VAR params: CodecCompressParams): ComponentResult;
  238.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  239.     INLINE $2F3C, $0004, $0003, $7000, $A82A;
  240.     {$ENDC}
  241. FUNCTION ImageCodecBandCompress(ci: ComponentInstance; VAR params: CodecCompressParams): ComponentResult;
  242.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  243.     INLINE $2F3C, $0004, $0004, $7000, $A82A;
  244.     {$ENDC}
  245. FUNCTION ImageCodecPreDecompress(ci: ComponentInstance; VAR params: CodecDecompressParams): ComponentResult;
  246.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  247.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  248.     {$ENDC}
  249. FUNCTION ImageCodecBandDecompress(ci: ComponentInstance; VAR params: CodecDecompressParams): ComponentResult;
  250.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  251.     INLINE $2F3C, $0004, $0006, $7000, $A82A;
  252.     {$ENDC}
  253. FUNCTION ImageCodecBusy(ci: ComponentInstance; seq: ImageSequence): ComponentResult;
  254.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  255.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  256.     {$ENDC}
  257. FUNCTION ImageCodecGetCompressedImageSize(ci: ComponentInstance; desc: ImageDescriptionHandle; data: Ptr; bufferSize: LONGINT; dataProc: ICMDataProcRecordPtr; VAR dataSize: LONGINT): ComponentResult;
  258.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  259.     INLINE $2F3C, $0014, $0008, $7000, $A82A;
  260.     {$ENDC}
  261. FUNCTION ImageCodecGetSimilarity(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; desc: ImageDescriptionHandle; data: Ptr; VAR similarity: Fixed): ComponentResult;
  262.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  263.     INLINE $2F3C, $0014, $0009, $7000, $A82A;
  264.     {$ENDC}
  265. FUNCTION ImageCodecTrimImage(ci: ComponentInstance; Desc: ImageDescriptionHandle; inData: Ptr; inBufferSize: LONGINT; dataProc: ICMDataProcRecordPtr; outData: Ptr; outBufferSize: LONGINT; flushProc: ICMFlushProcRecordPtr; VAR trimRect: Rect; progressProc: ICMProgressProcRecordPtr): ComponentResult;
  266.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  267.     INLINE $2F3C, $0024, $000A, $7000, $A82A;
  268.     {$ENDC}
  269. FUNCTION ImageCodecRequestSettings(ci: ComponentInstance; settings: Handle; VAR rp: Rect; filterProc: ModalFilterUPP): ComponentResult;
  270.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  271.     INLINE $2F3C, $000C, $000B, $7000, $A82A;
  272.     {$ENDC}
  273. FUNCTION ImageCodecGetSettings(ci: ComponentInstance; settings: Handle): ComponentResult;
  274.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  275.     INLINE $2F3C, $0004, $000C, $7000, $A82A;
  276.     {$ENDC}
  277. FUNCTION ImageCodecSetSettings(ci: ComponentInstance; settings: Handle): ComponentResult;
  278.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  279.     INLINE $2F3C, $0004, $000D, $7000, $A82A;
  280.     {$ENDC}
  281. FUNCTION ImageCodecFlush(ci: ComponentInstance): ComponentResult;
  282.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  283.     INLINE $2F3C, $0000, $000E, $7000, $A82A;
  284.     {$ENDC}
  285. FUNCTION ImageCodecSetTimeCode(ci: ComponentInstance; timeCodeFormat: UNIV Ptr; timeCodeTime: UNIV Ptr): ComponentResult;
  286.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  287.     INLINE $2F3C, $0008, $000F, $7000, $A82A;
  288.     {$ENDC}
  289. FUNCTION ImageCodecIsImageDescriptionEquivalent(ci: ComponentInstance; newDesc: ImageDescriptionHandle; VAR equivalent: BOOLEAN): ComponentResult;
  290.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  291.     INLINE $2F3C, $0008, $0010, $7000, $A82A;
  292.     {$ENDC}
  293. FUNCTION ImageCodecNewMemory(ci: ComponentInstance; VAR data: Ptr; dataSize: Size; dataUse: LONGINT; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UNIV Ptr): ComponentResult;
  294.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  295.     INLINE $2F3C, $0014, $0011, $7000, $A82A;
  296.     {$ENDC}
  297. FUNCTION ImageCodecDisposeMemory(ci: ComponentInstance; data: Ptr): ComponentResult;
  298.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  299.     INLINE $2F3C, $0004, $0012, $7000, $A82A;
  300.     {$ENDC}
  301. FUNCTION ImageCodecHitTestData(ci: ComponentInstance; desc: ImageDescriptionHandle; data: UNIV Ptr; dataSize: Size; where: Point; VAR hit: BOOLEAN): ComponentResult;
  302.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  303.     INLINE $2F3C, $0014, $0013, $7000, $A82A;
  304.     {$ENDC}
  305. FUNCTION ImageCodecNewImageBufferMemory(ci: ComponentInstance; VAR params: CodecDecompressParams; flags: LONGINT; memoryGoneProc: ICMMemoryDisposedUPP; refCon: UNIV Ptr): ComponentResult;
  306.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  307.     INLINE $2F3C, $0010, $0014, $7000, $A82A;
  308.     {$ENDC}
  309. FUNCTION ImageCodecExtractAndCombineFields(ci: ComponentInstance; fieldFlags: LONGINT; data1: UNIV Ptr; dataSize1: LONGINT; desc1: ImageDescriptionHandle; data2: UNIV Ptr; dataSize2: LONGINT; desc2: ImageDescriptionHandle; outputData: UNIV Ptr; VAR outDataSize: LONGINT; descOut: ImageDescriptionHandle): ComponentResult;
  310.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  311.     INLINE $2F3C, $0028, $0015, $7000, $A82A;
  312.     {$ENDC}
  313. FUNCTION ImageCodecGetMaxCompressionSizeWithSources(ci: ComponentInstance; src: PixMapHandle; {CONST}VAR srcRect: Rect; depth: INTEGER; quality: CodecQ; sourceData: CDSequenceDataSourcePtr; VAR size: LONGINT): ComponentResult;
  314.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  315.     INLINE $2F3C, $0016, $0016, $7000, $A82A;
  316.     {$ENDC}
  317.  
  318.  
  319.  
  320. CONST
  321.     kMotionJPEGTag                = 'mjpg';
  322.  
  323.  
  324. TYPE
  325.     MotionJPEGApp1MarkerPtr = ^MotionJPEGApp1Marker;
  326.     MotionJPEGApp1Marker = RECORD
  327.         unused:                    LONGINT;
  328.         tag:                    LONGINT;
  329.         fieldSize:                LONGINT;
  330.         paddedFieldSize:        LONGINT;
  331.         offsetToNextField:        LONGINT;
  332.         qTableOffset:            LONGINT;
  333.         huffmanTableOffset:        LONGINT;
  334.         sofOffset:                LONGINT;
  335.         sosOffset:                LONGINT;
  336.         soiOffset:                LONGINT;
  337.     END;
  338.  
  339.  
  340. FUNCTION QTPhotoSetSampling(codec: ComponentInstance; yH: INTEGER; yV: INTEGER; cbH: INTEGER; cbV: INTEGER; crH: INTEGER; crV: INTEGER): ComponentResult;
  341.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  342.     INLINE $2F3C, $000C, $0100, $7000, $A82A;
  343.     {$ENDC}
  344. FUNCTION QTPhotoSetRestartInterval(codec: ComponentInstance; restartInterval: INTEGER): ComponentResult;
  345.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  346.     INLINE $2F3C, $0002, $0101, $7000, $A82A;
  347.     {$ENDC}
  348. FUNCTION QTPhotoDefineHuffmanTable(codec: ComponentInstance; componentNumber: INTEGER; isDC: BOOLEAN; VAR lengthCounts: UInt8; VAR values: UInt8): ComponentResult;
  349.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  350.     INLINE $2F3C, $000C, $0102, $7000, $A82A;
  351.     {$ENDC}
  352. FUNCTION QTPhotoDefineQuantizationTable(codec: ComponentInstance; componentNumber: INTEGER; VAR table: UInt8): ComponentResult;
  353.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  354.     INLINE $2F3C, $0006, $0103, $7000, $A82A;
  355.     {$ENDC}
  356.  
  357. { UPP call backs }
  358.  
  359. {$ALIGN RESET}
  360. {$POP}
  361.  
  362. {$SETC UsingIncludes := ImageCodecIncludes}
  363.  
  364. {$ENDC} {__IMAGECODEC__}
  365.  
  366. {$IFC NOT UsingIncludes}
  367.  END.
  368. {$ENDC}
  369.